package com.hqd.ch03.v12.io.support;


import com.hqd.ch03.v12.io.Resource;

import java.io.IOException;
import java.io.InputStream;

/**
 * 类路径下的资源
 */
public class ClassPathResource implements Resource {
    private String path;

    public ClassPathResource(String path) {
        this.path = path;
    }

    @Override
    public InputStream getInputStream() throws IOException {
        return this.getClass().getClassLoader().getResourceAsStream(path);
    }
}
